import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/scroll_image_slider_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/scroll_image_slider_entity.g.dart';

@JsonSerializable()
class ScrollImageSliderEntity extends ContentData {
  String? indicator = '';
  @JSONField(name: "page_margin_top")
  int? pageMarginTop = 0;
  @JSONField(name: "show_origin_price")
  bool? showOriginPrice = false;
  @JSONField(name: "image_fill_style")
  String? imageFillStyle = '';
  @JSONField(name: "mask_color")
  String? maskColor = '';
  List<ScrollImageSliderGoods>? goods = [];
  @JSONField(name: "corner_mark_type")
  String? cornerMarkType = '';
  @JSONField(name: "text_align_type")
  String? textAlignType = '';
  @JSONField(name: "show_corner_mark")
  String? showCornerMark = '';
  String? uuid = '';
  @JSONField(name: "text_style_type")
  String? textStyleType = '';
  bool? price = false;
  @JSONField(name: "page_margin_right")
  int? pageMarginRight = 0;
  @JSONField(name: "buy_btn_type")
  String? buyBtnType = '';
  @JSONField(name: "sub_entry")
  List<ScrollImageSliderSubEntry>? subEntry = [];
  @JSONField(name: "image_style")
  String? imageStyle = '';
  @JSONField(name: "swipe_time")
  int? swipeTime = 0;
  bool? bottomrds = false;
  @JSONField(name: "page_margin_bottom")
  int? pageMarginBottom = 0;
  @JSONField(name: "sold_color")
  String? soldColor = '';
  @JSONField(name: "size_type")
  String? sizeType = '';
  @JSONField(name: "title_color")
  String? titleColor = '';
  @JSONField(name: "price_color")
  String? priceColor = '';
  @JSONField(name: "border_radius_type")
  String? borderRadiusType = '';
  @JSONField(name: "page_margin_left")
  int? pageMarginLeft = 0;
  @JSONField(name: "oldprice_color")
  String? oldpriceColor = '';
  int? bdr = 0;
  @JSONField(name: "bg_color")
  String? bgColor = '';
  @JSONField(name: "show_title")
  bool? showTitle = false;
  @JSONField(name: "corner_type")
  String? cornerType = '';
  @JSONField(name: "corner_mark_image")
  String? cornerMarkImage = '';
  @JSONField(name: "button_text")
  String? buttonText = '';

  ScrollImageSliderEntity() {
    type = 'imgslide01';
  }

  factory ScrollImageSliderEntity.fromJson(Map<String, dynamic> json) => $ScrollImageSliderEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $ScrollImageSliderEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return ScrollImageSliderEntity.fromJson(json);
  }
}

@JsonSerializable()
class ScrollImageSliderGoods {
  int? isCombination = 0;
  int? commoditySource = 0;
  String? className = '';
  double? priceMarket;
  int? secondClassID = 0;
  int? baseSpec = 0;
  int? number = 0;
  int? classId = 0;
  int? commodityStatus = 0;
  double? price;
  double? highPrice;
  String? id = '';
  String? supplierName = '';
  String? image = '';
  String? brandName = '';
  dynamic paySingle;
  int? priceType = 0;
  List<ScrollImageSliderGoodsSpecList>? specList = [];
  int? firstClassID = 0;
  String? commodityId = '';
  dynamic sort;
  int? commodityType = 0;
  String? barCode = '';
  String? spuSpecJsonBody = '';
  double? taxRate;
  String? mainImage = '';
  double? priceCost;
  List<dynamic>? discountLabel = [];
  int? commodityForm = 0;
  int? brandId = 0;
  double? highTaxRate;
  String? skuCode = '';
  String? commodityName = '';
  int? status = 0;

  ScrollImageSliderGoods();

  factory ScrollImageSliderGoods.fromJson(Map<String, dynamic> json) => $ScrollImageSliderGoodsFromJson(json);

  Map<String, dynamic> toJson() => $ScrollImageSliderGoodsToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ScrollImageSliderGoodsSpecList {
  dynamic taxRate;
  double? priceCost;
  int? specNum = 0;
  double? price;
  double? highPrice;
  double? priceMarket;
  double? profit;

  ScrollImageSliderGoodsSpecList();

  factory ScrollImageSliderGoodsSpecList.fromJson(Map<String, dynamic> json) => $ScrollImageSliderGoodsSpecListFromJson(json);

  Map<String, dynamic> toJson() => $ScrollImageSliderGoodsSpecListToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class ScrollImageSliderSubEntry {
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "image_height")
  int? imageHeight = 0;
  @JSONField(name: "image_url")
  String? imageUrl = '';
  @JSONField(name: "link_url")
  String? linkUrl = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  @JSONField(name: "image_width")
  int? imageWidth = 0;
  String? title = '';
  @JSONField(name: "link_id")
  String? linkId = '';

  ScrollImageSliderSubEntry();

  factory ScrollImageSliderSubEntry.fromJson(Map<String, dynamic> json) => $ScrollImageSliderSubEntryFromJson(json);

  Map<String, dynamic> toJson() => $ScrollImageSliderSubEntryToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
